package com.bytic.miaosha.redis;

public abstract class BaseKeyPrefix implements KeyPrefix {

    private int expire;
    private String prefix;

    public BaseKeyPrefix(String prefix) {
        this(0, prefix);
    }

    public BaseKeyPrefix(int expire, String prefix) {
        this.expire = expire;
        this.prefix = prefix;
    }

    @Override
    public int expire() {
        return expire;
    }

    @Override
    public String getPrefix() {
        String clazz = getClass().getSimpleName();
        return clazz + ":" + prefix;
    }
}
